package com.wz.utils.transaction.test.service;


import com.wz.utils.transaction.test.mapper.AccountInfoDao;
import com.wz.utils.transaction.test.mapper.ProductInfoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Component
@Service
@Transactional(rollbackFor = Exception.class)
public class PayServiceImpl implements PayService {

    @Autowired
    private AccountInfoDao accountInfoDao;

    @Autowired
    private ProductInfoDao productInfoDao;

    public void pay(String accountId, double money) {

        //更新余额
        int retVal = accountInfoDao.updateAccountBlance(accountId,money);


        //System.out.println(1/0);

        productInfoDao.updatePrice(1,"3.3333");

    }
}